package com.yanqu.road.server.cmd.cross.marriage;

import com.yanqu.road.pb.marriage.CrossMarriageProto;
import com.yanqu.road.pb.marriage.MarriageProto;
import com.yanqu.road.server.cmd.base.AbstractServerCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.marriage.MarriageMgr;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;


@Cmd(code = Protocol.S_CROSS_MARRIAGE_PUBLISH_UNION_RESP, desc = "跨服联姻发布商会响应")
public class CrossUnionMarriagePublishRespCmd extends AbstractServerCommand {
	private CrossMarriageProto.CrossMarriageApplyPublishUnionRespMsg reqMsg;

	@Override
	public boolean parseData(YanQuMessage packet) throws Exception {
		reqMsg = CrossMarriageProto.CrossMarriageApplyPublishUnionRespMsg.parseFrom(packet.getBytes());
		return true;
	}

	@Override
	public void execute(YanQuMessage packet) throws Exception {
		GamePlayer player = GamePlayerMgr.getPlayer(packet.getPlayerId());
		if(null != player) {
			ret = MarriageMgr.crossMarriagePublishUnionResponse(player, reqMsg);
			MarriageProto.MarriageApplyPublishRespMsg.Builder respMsg = MarriageProto.MarriageApplyPublishRespMsg.newBuilder();
			respMsg.setRet(ret);
			player.sendPacket(Protocol.U_MARRIAGE_APPLY_PUBLISH, respMsg);
		}
	}

	@Override
	public void sendData(YanQuMessage packet) throws Exception {

	}
}
